/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package investigaciones_itm;

import com.sun.rave.web.ui.appbase.AbstractPageBean;
import com.sun.webui.jsf.component.Tree;
import com.sun.webui.jsf.component.TreeNode;

import com.sun.webui.jsf.model.DefaultOptionsList;
import itm.bo.login.LoginBO;
import itm.exception.LoginException;
import itm.vo.login.RolVO;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.FacesException;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.servlet.http.HttpSession;

/**
 * <p>Page bean that corresponds to a similarly named JSP page.  This
 * class contains component definitions (and initialization code) for
 * all components that you have defined on this page, as well as
 * lifecycle methods and event handlers where you may add behavior
 * to respond to incoming events.</p>
 *
 * @version MenuITM.java
 * @version Created on 24/07/2009, 12:34:30 PM
 * @author jimmy
 */
public class MenuITM extends AbstractPageBean {

    // <editor-fold defaultstate="collapsed" desc="Managed Component Definition">
    /**
     * <p>Automatically managed component initialization.  <strong>WARNING:</strong>
     * This method is automatically generated, so any user-specified code inserted
     * here is subject to being replaced.</p>
     */
    private void _init() throws Exception {
    }

    // </editor-fold>
    private Tree dynamicTree = null;
    private LoginBO loginBO;
    private TreeNode nodeAdministrador;
    private TreeNode nodePersonas;
    private TreeNode nodeGrupos;
    private TreeNode nodeLineas;
    private TreeNode nodeConvocatorias;
    private TreeNode nodeProductos;
    private TreeNode nodeProyectos;
    private TreeNode nodePresupuesto;
    private boolean boolAdministrador;
    private boolean boolPersonas;
    private boolean boolGrupos;
    private boolean boolLineas;
    private boolean boolConvocatorias;
    private boolean boolProductos;
    private boolean boolProyectos;
    private boolean boolPresupuesto;
    private static final String MODULO_ADMINISTRADOR = "ADMINISTRACIÓN";
    private static final String MODULO_PERSONAS = "PERSONAS";
    private static final String MODULO_GRUPOS_INVESTIGACION = "GRUPOS DE INVESTIGACIÓN";
    private static final String MODULO_LINEAS_INVESTIGACION = "LÍNEAS DE INVESTIGACIÓN";
    private static final String MODULO_CONVOCATORIAS = "CONVOCATORIAS";
    private static final String MODULO_PRODUCTOS = "PRODUCTOS";
    private static final String MODULO_PROYECTOS_INVESTIGACION = "PROYECTOS DE INVESTIGACIÓN";
    private static final String MODULO_PRESUPUESTO = "PRESUPUESTO";
    private HttpSession session;
    private static final String ID_SESSION_MENU_ITM = "menu.itm";
    private String rol;

    public MenuITM() {
        inicializar();
    }

    protected void inicializar() {
        inicializarObjetos();
        cargarVariablesSession();
        cargarVariablesSessionLocal();

    }

    protected void inicializarObjetos() {
        loginBO = new LoginBO();
    }

    protected void cargarVariablesSession(){
        if(this.getSession().getAttribute("rol")!=null){
            setRol((String) this.getSession().getAttribute("rol"));
        }
    }

    protected void cargarVariablesSessionLocal() {
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeAdministrador") != null) {
            setNodeAdministrador((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeAdministrador"));
        } else {
            nodeAdministrador = new TreeNode();
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeConvocatorias") != null) {
            setNodeConvocatorias((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeConvocatorias"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeGrupos") != null) {
            setNodeGrupos((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeGrupos"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeLineas") != null) {
            setNodeLineas((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeLineas"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodePersonas") != null) {
            setNodePersonas((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodePersonas"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodePresupuesto") != null) {
            setNodePresupuesto((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodePresupuesto"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeProductos") != null) {
            setNodeProductos((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeProductos"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeProyectos") != null) {
            setNodeProyectos((TreeNode) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "nodeProyectos"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolAdministrador") != null) {
            setBoolAdministrador((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolAdministrador"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolConvocatorias") != null) {
            setBoolConvocatorias((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolConvocatorias"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolGrupos") != null) {
            setBoolGrupos((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolGrupos"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolLineas") != null) {
            setBoolLineas((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolLineas"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolPersonas") != null) {
            setBoolPersonas((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolPersonas"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolPresupuesto") != null) {
            setBoolPresupuesto((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolPresupuesto"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolProductos") != null) {
            setBoolProductos((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolProductos"));
        }
        if (this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolProyectos") != null) {
            setBoolProyectos((Boolean) this.getSession().getAttribute(ID_SESSION_MENU_ITM + "boolProyectos"));
        }
    }

    public Tree getDynamicTree() {
        if (dynamicTree == null) {
            dynamicTree = new Tree();
            dynamicTree.setText("Dynamic Tree Behavior Test");
        }
        return dynamicTree;
    }

    public void setDynamicTree(Tree t) {
        dynamicTree = t;
    }
    private TreeNode folder1 = null;

    public TreeNode getFolder1() {
        if (folder1 == null) {
            folder1 = new TreeNode();
            folder1.setUrl("#");
            folder1.setText("Folder 1");
            folder1.setExpanded(true);
        }
        return folder1;
    }

    public void setFolder1(TreeNode n) {
        folder1 = n;
    }
    private TreeNode folder2 = null;

    public TreeNode getFolder2() {
        if (folder2 == null) {
            folder2 = new TreeNode();
            folder2.setUrl("#");
            folder2.setText("Folder 2");
            folder2.setExpanded(true);
        }

        return folder2;
    }

    public void setFolder2(TreeNode n) {
        folder2 = n;
    }

    // int counter to name new nodes with
    int i = 0;

    public void nodeExpandedAdministracion(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolAdministrador() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_ADMINISTRADOR)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPADMIN");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }

                }
                setBoolAdministrador(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolAdministrador", isBoolAdministrador());
            }

            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodeAdministrador", getNodeAdministrador());

        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedPersonas(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolPersonas() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_PERSONAS)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPERSONA");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolPersonas(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolPersonas", isBoolPersonas());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodePersonas", getNodePersonas());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedGruposInvestigacion(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolGrupos() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_GRUPOS_INVESTIGACION)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPGRUPO");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolGrupos(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolGrupos", isBoolGrupos());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodeGrupos", getNodeGrupos());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedLineasInvestigacion(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolLineas() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_LINEAS_INVESTIGACION)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPLINEAS");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolLineas(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolLineas", isBoolLineas());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodeLineas", getNodeLineas());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedConvocatorias(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolConvocatorias() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_CONVOCATORIAS)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPCONVO");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolConvocatorias(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolConvocatorias", isBoolConvocatorias());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodeConvocatorias", getNodeConvocatorias());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedProductos(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolProductos() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_PRODUCTOS)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPRODUC");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolProductos(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolProductos", isBoolProductos());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodeProductos", getNodeProductos());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedProyectosInvestigacion(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolProyectos() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_PROYECTOS_INVESTIGACION)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPROYECT");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolProyectos(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolProyectos", isBoolProyectos());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodeProyectos", getNodeProyectos());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public void nodeExpandedPresupuesto(ActionEvent event) {
        TreeNode node = (TreeNode) event.getComponent();
        List<RolVO> lista = new ArrayList<RolVO>();
        boolean sinPermisos = false;
        try {
            lista = loginBO.ObtenerPermisosRol(Long.parseLong(rol));
            if (isBoolPresupuesto() == false) {
                if (!node.isExpanded()) {
                    for (int j = 0; j < lista.size(); j++) {
                        if (lista.get(j).getNombreModulo().equals(MODULO_PRESUPUESTO)) {
                            TreeNode newNode = new TreeNode();
                            newNode.setId(lista.get(j).getIdCaso());
                            newNode.setText(lista.get(j).getNombreCaso());
                            newNode.setUrl(lista.get(j).getUrl());
                            newNode.setStyleClass("menuChild");
                            newNode.setStyle("menuChild");
                            node.getChildren().add(newNode);
                            sinPermisos = true;
                        }
                    }
                    if(sinPermisos==false){
                        TreeNode newNode = new TreeNode();
                            newNode.setId("SINPRESUP");
                            newNode.setText("NO TIENE PERMISOS SOBRE ESTE MODULO");
                            newNode.setUrl("#");
                            newNode.setStyleClass("menuChild");
                            node.getChildren().add(newNode);
                    }
                }
                setBoolPresupuesto(true);
                this.getSession().setAttribute(ID_SESSION_MENU_ITM + "boolPresupuesto", isBoolPresupuesto());
            }
            this.getSession().setAttribute(ID_SESSION_MENU_ITM + "nodePresupuesto", getNodePresupuesto());
        } catch (LoginException ex) {
            Logger.getLogger(MenuITM.class.getName()).log(Level.SEVERE, null, ex);
            ex.printStackTrace();
        }
    }

    public String actionNodoMenu() {

        return "crear_roles";
    }

    
    private DefaultOptionsList menu1DefaultOptions = new DefaultOptionsList();

    public DefaultOptionsList getMenu1DefaultOptions() {
        return menu1DefaultOptions;
    }

    public void setMenu1DefaultOptions(DefaultOptionsList dol) {
        this.menu1DefaultOptions = dol;
    }

    public TreeNode getNodeAdministrador() {
        return nodeAdministrador;
    }

    public void setNodeAdministrador(TreeNode nodeAdministrador) {
        this.nodeAdministrador = nodeAdministrador;
    }

    public HttpSession getSession() {
        return (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
    }

    public void setSession(HttpSession session) {
        this.session = session;
    }

    public TreeNode getNodeConvocatorias() {
        return nodeConvocatorias;
    }

    public void setNodeConvocatorias(TreeNode nodeConvocatorias) {
        this.nodeConvocatorias = nodeConvocatorias;
    }

    public TreeNode getNodeGrupos() {
        return nodeGrupos;
    }

    public void setNodeGrupos(TreeNode nodeGrupos) {
        this.nodeGrupos = nodeGrupos;
    }

    public TreeNode getNodeLineas() {
        return nodeLineas;
    }

    public void setNodeLineas(TreeNode nodeLineas) {
        this.nodeLineas = nodeLineas;
    }

    public TreeNode getNodePersonas() {
        return nodePersonas;
    }

    public void setNodePersonas(TreeNode nodePersonas) {
        this.nodePersonas = nodePersonas;
    }

    public TreeNode getNodePresupuesto() {
        return nodePresupuesto;
    }

    public void setNodePresupuesto(TreeNode nodePresupuesto) {
        this.nodePresupuesto = nodePresupuesto;
    }

    public TreeNode getNodeProductos() {
        return nodeProductos;
    }

    public void setNodeProductos(TreeNode nodeProductos) {
        this.nodeProductos = nodeProductos;
    }

    public TreeNode getNodeProyectos() {
        return nodeProyectos;
    }

    public void setNodeProyectos(TreeNode nodeProyectos) {
        this.nodeProyectos = nodeProyectos;
    }

    public boolean isBoolAdministrador() {
        return boolAdministrador;
    }

    public void setBoolAdministrador(boolean boolAdministrador) {
        this.boolAdministrador = boolAdministrador;
    }

    public boolean isBoolConvocatorias() {
        return boolConvocatorias;
    }

    public void setBoolConvocatorias(boolean boolConvocatorias) {
        this.boolConvocatorias = boolConvocatorias;
    }

    public boolean isBoolGrupos() {
        return boolGrupos;
    }

    public void setBoolGrupos(boolean boolGrupos) {
        this.boolGrupos = boolGrupos;
    }

    public boolean isBoolLineas() {
        return boolLineas;
    }

    public void setBoolLineas(boolean boolLineas) {
        this.boolLineas = boolLineas;
    }

    public boolean isBoolPersonas() {
        return boolPersonas;
    }

    public void setBoolPersonas(boolean boolPersonas) {
        this.boolPersonas = boolPersonas;
    }

    public boolean isBoolPresupuesto() {
        return boolPresupuesto;
    }

    public void setBoolPresupuesto(boolean boolPresupuesto) {
        this.boolPresupuesto = boolPresupuesto;
    }

    public boolean isBoolProductos() {
        return boolProductos;
    }

    public void setBoolProductos(boolean boolProductos) {
        this.boolProductos = boolProductos;
    }

    public boolean isBoolProyectos() {
        return boolProyectos;
    }

    public void setBoolProyectos(boolean boolProyectos) {
        this.boolProyectos = boolProyectos;
    }

    public String getRol() {
        return rol;
    }

    public void setRol(String rol) {
        this.rol = rol;
    }



    /* public String addNode() {

    String nodeId = getDynamicTree().getSelected();

    if (nodeId == null) {
    return "";
    }

    UIComponent node = getDynamicTree().findComponent(":" + nodeId);

    if (node != null) {
    TreeNode newNode = createNode(i++);
    node.getChildren().add(newNode);
    }

    return "";
    }

    public String deleteNode() {
    String nodeId = (String) getDynamicTree().getSelected();

    if (nodeId == null) {
    return "";
    }

    UIComponent node = getDynamicTree().findComponent(":" + nodeId);

    if (node != null) {
    UIComponent parent = node.getParent();

    List kids = parent.getChildren();
    kids.remove((Object) node);
    }

    return "";
    }*/
    /**
     * <p>Construct a new Page bean instance.</p>
     */
    /**
     * <p>Callback method that is called whenever a page is navigated to,
     * either directly via a URL, or indirectly via page navigation.
     * Customize this method to acquire resources that will be needed
     * for event handlers and lifecycle methods, whether or not this
     * page is performing post back processing.</p>
     * 
     * <p>Note that, if the current request is a postback, the property
     * values of the components do <strong>not</strong> represent any
     * values submitted with this request.  Instead, they represent the
     * property values that were saved for this view when it was rendered.</p>
     */
    @Override
    public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here

        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            _init();
        } catch (Exception e) {
            log("MenuITM Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
        }

    // </editor-fold>
    // Perform application initialization that must complete
    // *after* managed components are initialized
    // TODO - add your own initialization code here
    }

    /**
     * <p>Callback method that is called after the component tree has been
     * restored, but before any event processing takes place.  This method
     * will <strong>only</strong> be called on a postback request that
     * is processing a form submit.  Customize this method to allocate
     * resources that will be required in your event handlers.</p>
     */
    @Override
    public void preprocess() {
    }

    /**
     * <p>Callback method that is called just before rendering takes place.
     * This method will <strong>only</strong> be called for the page that
     * will actually be rendered (and not, for example, on a page that
     * handled a postback and then navigated to a different page).  Customize
     * this method to allocate resources that will be required for rendering
     * this page.</p>
     */
    @Override
    public void prerender() {
    }

    /**
     * <p>Callback method that is called after rendering is completed for
     * this request, if <code>init()</code> was called (regardless of whether
     * or not this was the page that was actually rendered).  Customize this
     * method to release resources acquired in the <code>init()</code>,
     * <code>preprocess()</code>, or <code>prerender()</code> methods (or
     * acquired during execution of an event handler).</p>
     */
    @Override
    public void destroy() {
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected ApplicationBean1 getApplicationBean1() {
        return (ApplicationBean1) getBean("ApplicationBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected RequestBean1 getRequestBean1() {
        return (RequestBean1) getBean("RequestBean1");
    }

    /**
     * <p>Return a reference to the scoped data bean.</p>
     *
     * @return reference to the scoped data bean
     */
    protected SessionBean1 getSessionBean1() {
        return (SessionBean1) getBean("SessionBean1");
    }
}

